﻿CREATE TABLE [dbo].[ProcessVersions] (
    [ProcessVersionID] INT            IDENTITY (1, 1) NOT NULL,
    [EffectiveDate]    DATETIME       NULL,
    [VersionName]      NVARCHAR (MAX) NULL,
    [WorkflowID]       INT            NOT NULL,
    CONSTRAINT [PK_dbo.ProcessVersions] PRIMARY KEY CLUSTERED ([ProcessVersionID] ASC),
    CONSTRAINT [FK_dbo.ProcessVersions_dbo.Workflows_WorkflowID] FOREIGN KEY ([WorkflowID]) REFERENCES [dbo].[Workflows] ([WorkflowID]) ON DELETE CASCADE
);


GO
CREATE NONCLUSTERED INDEX [IX_WorkflowID]
    ON [dbo].[ProcessVersions]([WorkflowID] ASC);

